<?php

function my_robots () {
    if (is_home () || is_front_page () || is_single () || is_page ()) {

?>
<meta name="robots" content="index, follow, noodp"/>
<?php

    } else {

?>
<meta name="robots" content="noindex, follow"/>
<?php

    }
}
add_action ('wp_head', 'my_robots');

?>
